package com.shishuo.cms.action.user;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;

import com.shishuo.cms.action.BaseAjaxAction;
import com.shishuo.cms.constant.UserConstant;
import com.shishuo.cms.entity.UserEntity;
import com.shishuo.cms.service.CashService;
import com.shishuo.cms.service.ConfigService;
import com.shishuo.cms.service.GoldService;
import com.shishuo.cms.service.MyNetService;
import com.shishuo.cms.service.UserCallBackGoodsService;
import com.shishuo.cms.service.UserFavGoodsService;
import com.shishuo.cms.service.UserScanGoodsService;
import com.shishuo.cms.service.UserService;
import com.shishuo.cms.service.UserWebEmailService;


public class UserBaseAction extends BaseAjaxAction
{
	@Autowired
	protected ConfigService configService;
	@Autowired
	protected UserService userService;
	@Autowired
	protected CashService cashService;
	@Autowired
	protected GoldService goldService;
	@Autowired
	protected MyNetService myNetService;
	@Autowired
	protected UserWebEmailService userWebEmailService;
	@Autowired
	protected UserFavGoodsService userFavGoodsService;
	@Autowired
	protected UserScanGoodsService userScanGoodsService;
	@Autowired
	protected UserCallBackGoodsService userCallBackGoodsService;
	public void updateUserSession() throws Exception {
		HttpSession session = request.getSession();
		UserEntity userEntity=(UserEntity) session.getAttribute(UserConstant.SESSION_USER);
		UserEntity userEntityDb=userService.getById(userEntity.getId());
		session.setAttribute(UserConstant.SESSION_USER, userEntityDb);
	}
	
	public String getTemplatePath() throws Exception
	{
		return "template/" + configService.getConfigByKey("SYS_THEME")+"/" ;
	}
}
